﻿using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Metadata;
using rpc_service.cache;
using rpc_service.config;
using rpc_service.core;
using rpc_service.core.interceptor.impl;
using rpc_service.core.registry;
using rpc_service.core.support;
using rpc_service.core.support.assembly;
using rpc_service.external;
using rpc_service.test;

class Program
{
    static void Main()
    {
        // 预加载
        TypeCache.Preload();
        // 加载配置
        new LoadConfig("C:\\Users\\yaobinsha\\Desktop\\csharp-rpc\\rpc-service\\config\\config.json");
        // 生成代理代码
        DynamicClassGenerator generator = new DynamicClassGenerator();
        IDictionary<string, object> objects = generator.Generate();
        RequestInterceptor.GetUUIDApi = (UUIDApi)objects["UUIDApi"];
        Test obj = (objects["Test"] as Test)!;
        // // Test obj = new TestProxy();
        Console.WriteLine(obj.Test1().Result);
        // Console.WriteLine(obj.Test2(1));    
        // // Console.WriteLine(obj.TestRpcMethod("asdfa"));
        // // Console.WriteLine(obj.TestRpcMethod1("dsafdsfads"));
        // Console.WriteLine(obj.TestRpcMethod2("asfsadfdsaf").Count);
        // Console.WriteLine(obj.TestRpcMethod3(new TestModel() { id = "1" }));
        // Console.WriteLine(obj.TestRpcMethod4(new TestModel() { id = "1" }).Result);
        // Test3 obj3 = (objs[2] as Test3)!;
        // Console.WriteLine(obj3.Test1());
    }
}